import React, { Component } from 'react'

// 需求：点击按钮，让数字在原来的基础上 +1
// 1. 给按钮绑定点击事件
// 2. 获取原来的数字
// 3. +1

export default class App extends Component {
  state = {
    count: 1,
  }
  handleClick(e) {
    console.log(this.state.count, e)
  }
  render() {
    return (
      <div style={{ textAlign: 'center' }}>
        <h2>计数器：{this.state.count}</h2>
        <button onClick={(e) => this.handleClick(e)}>+1</button>
      </div>
    )
  }
}
